package frontend.parser.syntaxtree;

import frontend.parser.syntaxtree.symbol.NonTerminalSymbol;
import frontend.parser.syntaxtree.symbol.TerminalSymbol;

import java.util.function.Consumer;

/**
 * decl
 * @author 杨凯伟
 * @date 2024/10/14
 */
public class BlockItemNodeForDecl extends BlockItemNode {
    public DeclNode decl;

    @Override
    public void walk(Consumer<TerminalSymbol> terConsumer, Consumer<NonTerminalSymbol> nonTerConsumer) {
        decl.walk(terConsumer, nonTerConsumer);//递归地遍历声明节点
        //将当前节点（this）包装成一个 NonTerminalSymbol 对象，并传递给 nonTerConsumer，表示当前节点是一个非终结符
        nonTerConsumer.accept(new NonTerminalSymbol(this));
    }
}
